import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProductComboInfoVO, ProductComboInfoForm, ProductComboInfoQuery } from '@/api/lingxing/productComboInfo/types';

/**
 * 查询领星产品组合信息列表
 * @param query
 * @returns {*}
 */

export const listProductComboInfo = (query?: ProductComboInfoQuery): AxiosPromise<ProductComboInfoVO[]> => {
  return request({
    url: '/lingxing/productComboInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询领星产品组合信息详细
 * @param id
 */
export const getProductComboInfo = (id: string | number): AxiosPromise<ProductComboInfoVO> => {
  return request({
    url: '/lingxing/productComboInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增领星产品组合信息
 * @param data
 */
export const addProductComboInfo = (data: ProductComboInfoForm) => {
  return request({
    url: '/lingxing/productComboInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改领星产品组合信息
 * @param data
 */
export const updateProductComboInfo = (data: ProductComboInfoForm) => {
  return request({
    url: '/lingxing/productComboInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除领星产品组合信息
 * @param id
 */
export const delProductComboInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/lingxing/productComboInfo/' + id,
    method: 'delete'
  });
};

/**
 * 同步领星接口
 * @returns {*}
 */
export const syncData = (query?: ProductComboInfoQuery) => {
  return request({
    url: '/lingxing/productComboInfo/syncData',
    method: 'post',
    data: query
  });
};

export const getNewestUpdateTime = () => {
  return request({
    url: '/lingxing/productComboInfo/getNewestUpdateTime',
    method: 'get'
  });
};
